<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
  </head>
  <body>
    输入关键字:<input class="word"/>
    <button class="search">点击搜索</button>
    <ul class="ulBox"></ul>
    <script>
    // function jsonp_3(res){
    //     console.log(res)
    // }
      $(".search").on("click", () => {
      let val=$('.word').val()
      let ul=document.querySelector("ul").innerHTML = "";
        $.ajax({
          url: `https://suggestion.baidu.com/su`,
          dataType: "jsonp",
          jsonp: "callback",
          data: {
            wd:val
          },
        jsonp:'cb',
        success(res){
         console.log(res.s)
        }
         
        });
      });
    </script>
  </body>
</html>
